import { onMounted, watch, ref, reactive } from 'vue'
let testDargListInit = [
    {
        label: '单选',
        value: 'single'
    },
    {
        label: '多选',
        value: 'multiple'
    },
    {
        label: '判断',
        value: 'judge'
    },
    {
        label: '案例',
        value: 'case'
    },
    {
        label: '填空',
        value: 'fillBlank'
    },
    {
        label: '简答',
        value: 'shortAnswer'
    },
]

let practiceDargListInit = [
    {
        label: '单选',
        value: 'single'
    },
    {
        label: '多选',
        value: 'multiple'
    },
    {
        label: '判断',
        value: 'judge'
    },
    {
        label: '案例',
        value: 'case'
    },
    {
        label: '填空',
        value: 'fillBlank'
    },
    {
        label: '简答',
        value: 'shortAnswer'
    },

]
export default function () {
    const configRuleObj = {
        testDargListInit,
        practiceDargListInit,
        dargList: reactive({
            practice: [practiceDargListInit],
            test: [testDargListInit]
        }),
        // 下拉框校验
        rules: reactive({
            courseBankTypeId: [
                { required: true, message: '请选择题库类型', trigger: 'change' },
            ],
            courseIdMain: [
                { required: true, message: '请选择类目', trigger: 'change' },
            ],
            courseParentId: [
                { required: true, message: '请选择类别', trigger: 'change' },
            ],
        }),
        // 科目题型遍历数据
        saveOptions: reactive({
            courseOption: [],
            courseOtherOption: [],
            courseBankTypeOption: [],
            subOption: [
                {
                    children: {
                        testPracticePercent: '',
                        testResiduePercent: '',
                        testDurationMinute: '',
                        "practicePercent": '',
                        practiceConfModeTypeCode: '',
                        practiceOrderRule: {
                            "typeCode": "manualSortType", //排序规则 顺序打乱 disruption 手动排序 manualSortType
                            "questionTypeCodeList": [
                                "single",
                                "multiple",
                                "judge",
                                "case",
                                "fillBlank",
                                "shortAnswer"
                            ] //题目题型顺序排序
                        },
                        "testOrderRule": {
                            "typeCode": "manualSortType", //排序规则 顺序打乱 disruption 手动排序 manualSortType
                            "questionTypeCodeList": [
                                "single",
                                "multiple",
                                "judge",
                                "case",
                                "fillBlank",
                                "shortAnswer"
                            ] //题目题型顺序排序
                        },
                        "testAmountConfMap": {
                            "single": '', //单选题数量
                            "judge": '', //判断题数量
                            "multiple": '', //多选题数量
                            "case": '',//案例题数量
                            "fillBlank": '',
                            "shortAnswer": '',
                        }, //测试题目数量配置,
                        testCorrectConfMap: {
                            //单选题配置 题目分数
                            fillBlank: { mark: '' },
                            shortAnswer: { mark: '' },
                            single: { mark: '' },
                            judge: { mark: '' },
                            multiple: {
                                "mark": '', //题目分数
                                "incompleteHalfMarkFlag": true //漏选得一半标签
                            }
                        }
                    }
                }
            ],
            showPracticeDifference: false,
            showTestFifference: false,
            practiceConfModeTypeCode: '',
            practiceOrderRule: {
                "typeCode": "manualSortType", //排序规则 顺序打乱 disruption 手动排序 manualSortType
                "questionTypeCodeList": [
                    "single",
                    "multiple",
                    "judge",
                    "case",
                    "fillBlank",
                    "shortAnswer"
                ] //题目题型顺序排序
            },
        }),
        // 请求参数配置
        configRuleRequest: reactive({
            id: null,
            "courseIdMain": '', //类目id
            "courseParentId": '', //类别id
            practiceConfModeTypeCode: 'unify',
            practiceOrderRule: {
                "typeCode": "manualSortType", //排序规则 顺序打乱 disruption 手动排序 manualSortType
                "questionTypeCodeList": [
                    "single",
                    "multiple",
                    "judge",
                    "case",
                    "fillBlank",
                    "shortAnswer"
                ] //题目题型顺序排序
            },
            "courseBankTypeId": '', //课程题库类型id
            "practicePercent": '', //练习占总题库百分比
            "practiceModeCodeList": [], //练习模式列表 答题模式:answer、背题模式:recitation
            "testConfModeTypeCode": "unify", //测试题库规则指定类别：统一:unify、区分:difference
            "testPracticePercent": '', //测试题库中占练习题库百分比
            "testResiduePercent": '', //测试题库中占剩余题库百分比
            "testDurationMinute": '', //测试时长分钟
            "testAmountConfMap": {
                "single": null, //单选题数量
                "judge": null, //判断题数量
                "multiple": null, //多选题数量
                "case": null, //案例题数量
                "fillBlank": null,
                "shortAnswer": null,
            }, //测试题目数量配置,
            testCorrectConfMap: {
                //单选题配置 题目分数
                fillBlank: { mark: '' },
                shortAnswer: { mark: '' },
                single: { mark: null },
                judge: { mark: null },
                multiple: {
                    "mark": null, //题目分数
                    "incompleteHalfMarkFlag": true //漏选得一半标签
                }
            },
            testOrderRule: [],
            "testTotalAmount": null, //测试总题目数量
            "testTotalMark": null, //测试总分数
            children: []
        }),
        subOptionClearSubOption: reactive([
            {
                children: {
                    testPracticePercent: '',
                    testResiduePercent: '',
                    testDurationMinute: '',
                    "practicePercent": '',
                    practiceConfModeTypeCode: '',
                    practiceOrderRule: {
                        "typeCode": "manualSortType", //排序规则 顺序打乱 disruption 手动排序 manualSortType
                        "questionTypeCodeList": [
                            "single",
                            "multiple",
                            "judge",
                            "case",
                            "fillBlank",
                            "shortAnswer"
                        ] //题目题型顺序排序
                    },
                    "testOrderRule": {
                        "typeCode": "manualSortType", //排序规则 顺序打乱 disruption 手动排序 manualSortType
                        "questionTypeCodeList": [
                            "single",
                            "multiple",
                            "judge",
                            "case",
                            "fillBlank",
                            "shortAnswer"
                        ] //题目题型顺序排序
                    },
                    "testAmountConfMap": {
                        "single": '', //单选题数量
                        "judge": '', //判断题数量
                        "multiple": '', //多选题数量
                        "fillBlank": '', //多选题数量
                        "shortAnswer": '', //多选题数量
                        "case": '' //案例题数量
                    }, //测试题目数量配置,
                    testCorrectConfMap: {
                        //单选题配置 题目分数
                        fillBlank: { mark: '' },
                        shortAnswer: { mark: '' },
                        single: { mark: '' },
                        judge: { mark: '' },
                        multiple: {
                            "mark": '', //题目分数
                            "incompleteHalfMarkFlag": true //漏选得一半标签
                        }
                    }
                }
            }
        ]),
    }
    // 题型排序数据
    return configRuleObj;
}